<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div class="app">
        <p>message的值是{{message | capitalize}}</p>
    </div>
    <script>
        const vm = new Vue({
            el: '.app',
            data: {
                message: 'hello vue'
            },
            // 过滤器函数和data 对象平级
            filters: {
                capitalize(val){
                    // 过滤器中一定要有一个返回值
                    // 过滤器函数的形参是管道符的前面那个值
                    // console.log(val.charAt(0))
                    const first = val.charAt(0).toUpperCase()
                    const other = val.slice(1)
                    return first + other
                    // return val
                }
            }
        })
    </script>
</body>
</html>